﻿namespace SimpleFactoryPatterDemo
{
    /// <summary>
    /// 简单工厂角色类
    /// </summary>
    public class SimpleFactory
    {
        public static Operation GetOperation(string operate)
        {
            Operation operation = null;
            switch (operate)
            {
                case "+":
                    operation = new AddOperation();
                    break;
                case "-":
                    operation = new SubOperation();
                    break;
                case "*":
                    operation = new MulOperation();
                    break;
                case "/":
                    operation = new DivOperation();
                    break;
            }

            return operation;
        }
    }
}